home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / include / MotifApp / Application.h next >
Encoding:
C/C++ Source or Header  |  1995-07-17  |  2.7 KB  |  93 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //         This example code is from the book:
  4. //
  5. //           Object-Oriented Programming with C++ and OSF/Motif
  6. //         by
  7. //           Douglas Young
  8. //           Prentice Hall, 1992
  9. //           ISBN 0-13-630252-1    
  10. //
  11. //         Copyright 1991 by Prentice Hall
  12. //         All Rights Reserved
  13. //
  14. //  Permission to use, copy, modify, and distribute this software for 
  15. //  any purpose except publication and without fee is hereby granted, provided 
  16. //  that the above copyright notice appear in all copies of the software.
  17. ///////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. ////////////////////////////////////////////////////////////
  22. // Application.h: 
  23. ////////////////////////////////////////////////////////////
  24. #ifndef APPLICATION_H
  25. #define APPLICATION_H
  26. #include "UIComponent.h"
  27.  
  28. class Application : public UIComponent {
  29.     
  30.     // Allow main and MainWindow to access protected member functions
  31.  
  32. #if (XlibSpecificationRelease>=5)
  33.     friend int main ( int, char ** );
  34. #else
  35.     friend int main ( unsigned int, char ** );
  36. #endif
  37.     
  38.     friend class MainWindow;  // MainWindow needs to call 
  39.  
  40.     // private functions for registration
  41.  
  42.   private:    
  43.     
  44.     // Functions for registering and unregistering toplevel windows
  45.     
  46.     void registerWindow ( MainWindow * );
  47.     void unregisterWindow ( MainWindow * );
  48.     
  49.   protected:
  50.     
  51.     // Support commonly needed data structures as a convenience
  52.     
  53.     Display     *_display;
  54.     XtAppContext _appContext;
  55.     
  56.     // Functions to handle Xt interface
  57. #if (XlibSpecificationRelease>=5)   
  58.     virtual void initialize ( int *, char ** );  
  59. #else
  60.     virtual void initialize ( unsigned int *, char ** );  
  61. #endif
  62.     virtual void handleEvents();
  63.     
  64.     char   *_applicationClass;    // Class name of this application
  65.     MainWindow  **_windows;       // top-level windows in the program
  66.     int           _numWindows;
  67.     
  68.   public:
  69.     
  70.     Application ( char * );
  71.     virtual ~Application();     
  72.     
  73.     // Functions to manipulate application's top-level windows
  74.     
  75.     void manage();
  76.     void unmanage();
  77.     void iconify();
  78.     
  79.     // Convenient access functions
  80.     
  81.     Display      *display()     { return _display; }
  82.     XtAppContext  appContext()  { return _appContext; }
  83.     const char   *applicationClass()  { return _applicationClass; }
  84.     
  85.     virtual const char *const className() { return "Application"; }
  86. };
  87.  
  88. // Pointer to single global instance
  89.  
  90. extern Application *theApplication; 
  91.  
  92. #endif
  93.